package top.yuzt.noticeserver.mapper;

import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import top.yuzt.noticeserver.entity.Messages;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import top.yuzt.noticeserver.entity.Users;

import java.util.List;

/**
 * <p>
 *  Mapper 接口
 * </p>
 *
 * @author yuzt
 * @since 2024-05-05
 */
@Mapper
public interface MessagesMapper extends BaseMapper<Messages> {

    @Select("SELECT * FROM messages WHERE group_id = #{groupId} AND message_text LIKE CONCAT('%', #{keyword}, '%')")
    List<Messages> selectMessagesByGroupIdAndKeyword(@Param("groupId") Long groupId, @Param("keyword") String keyword);
    @Select("SELECT * FROM Messages WHERE GroupID = #{groupid}")
    List<Messages> findByGroupID(Integer groupid);

    @Select("SELECT * FROM Messages WHERE MessageID = #{messageid}")
    List<Messages> findByMessageID(Integer messageid);
}
